<?php
// @formatter:off
/**
 * @file dynamic.conf.grants.php
 * @author Alejandro Dario Simi
 * @date $Date: 2013-06-07 02:16:25 +0000 (Fri, 07 Jun 2013) $
 *
 * $Id: dynamic.conf.grants.php 71 2013-06-07 02:16:25Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0-BETA2/includes/dynamic.conf.grants.php $
 */
// @formatter:on

if(!$wcGroup || !$wcProfile->grantedGroup($wcGroup)) {
	$wcGroupForbidden = $wcGroup;
	if(!$wcGroup) {
		$wcActionForbidden = $wcAction;
		$wcAction = WC_PAGEERROR_500;
		$wcThemeAssigns["HTTP-ERROR-MESSAGE"] = "Requested group does not exists.";
	} else {
		$wcActionForbidden = $wcAction;
		$wcAction = WC_PAGEERROR_403;
		$wcThemeAssigns["HTTP-ERROR-MESSAGE"] = "Your current access clearence doesn't allow you to visit this group.";
	}

	//
	// Setting default group to avoid further errors.
	$wcGroup = $wcGroupsHolder->groupById($wcDefaults['group']);
	//
	// Checking if the action should be rechanged.
	if(defined("__INDEX__") || defined("__MOBILE__")) {
		if(!$wcGroup->isPublic()) {
			$wcAction = WC_ACTION_NOTHING;
		}
	} elseif(defined("__SERVICE__") || defined("__SIMPLE_CONTAINER__") || defined("__RSS__")) {
		$wcAction = $wcActionForbidden;
		$wcActionForbidden = false;
	}
}
?>